<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>注册账户</title>
<script type="text/javascript" src="js/jquery-3.2.1.min.js" ></script>
</head>
<body>

<div align="center"><img src="images/tennis_tiny.jpg" alt="图片无法显示" /></div>
<form method="post" id="mainForm" action="register">
<table width="40%" border="0" align="center">
	<tbody>
		<tr>
			<td colspan="2"><div align="center">注册新用户</div></td>
		</tr>
		<tr>
			<td>用户名（最长20字符）<br></td>
			<td><input type="text" maxlength="20" size="50" name="userName"></td>
		</tr>
		<tr>
			<td>姓名（最长10个字符）</td>
			<td><input type="text" maxlength="10" size="10" name="name"></td>
		</tr>
		<tr>
			<td>密码（最长20字符）</td>
			<td><input type="password" maxlength="20" size="50" name="passwd"></td>
		</tr>
		<tr>
			<td>电子邮件</td>
			<td><input type="text" maxlength="30" size="50" name="emailAddr"></td>
		</tr>
		<tr>
			<td>手机</td>
			<td><input type="text" maxlength="20" size="50" name="mobile"></td>
		</tr>
		<tr>
			<td valign="top"><br></td>
			<td valign="top"><input type="button" value="注册" name="btnSubmit" onclick="register()">
				<input type="button" value="取消" name="btnCancel" onclick="history.go(-1)"> </td>
		</tr>
	</tbody>
</table>
</form>
<div id="blockMuchDisplayDiv" style="display:none; POSITION:absolute; left:55%; top:50%; width:300px;  margin-left:-232px; margin-top:-12x; background-color:#d8f3f0; text-align:left; padding:10px 15px">
	<span id="blockMsg" style="margin:15px"></span>
	
</div>
</body>
<script type="text/javascript">

function register(){
	$.ajax({
		type : "post",
		url : "open/regist",
		contentType: 'application/json',
		data : JSON.stringify({
			"userName" : $("input[name='userName']").val(),
			"name" : $("input[name='name']").val(),
			"passwd" : $("input[name='passwd']").val(),
			"emailAddr" : $("input[name='emailAddr']").val(),
			"mobile" : $("input[name='mobile']").val()
		}),
		beforeSend: function(){
       		$('#blockMuchDisplayDiv').show();
       		$("#blockMsg").html("正在注册，请稍后!");
      	},
		dataType : "json",
		success : function(data) {
			$("#blockMsg").html(data.errorMsg);
			setTimeout(function(){//两秒后跳转
				 location.href = "login.html"; //手机网页式跳转
			},3000);
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			$('#blockMuchDisplayDiv').hide();
		}
	});
}
</script>
</html>